<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="bolao" />
    <g:set var="entityName" value="${message(code: 'role.label', default: 'Role')}" />
    <title><g:message code="default.show.label" args="[entityName]" /></title>
  </head>
  <body>
    <div class="body">
      <g:if test="${flash.message}">
      <div class="message">${flash.message}</div>
      </g:if>
      <div class="dialog">
        <fieldset>
          <legend><g:message code="default.show.label" args="[entityName]" /></legend>
          <table>
            <tbody>
              <tr class="prop">
                <td valign="top" class="name"><g:message code="role.code.label"/>:</td>
                <td valign="top" class="value">${role.code}</td>
              </tr>
              <tr class="prop">
                <td valign="top" class="name"><g:message code="role.description.label"/>:</td>
                <td valign="top" class="value">${role.description}</td>
              </tr>
              <g:if test="${!role?.users.isEmpty()}">
              <tr>
                <td colspan="2"><g:message code="role.users.label"/>:</td>
              </tr>
              <tr>
                <td colspan="2">
                  <div class="list">
                    <table class="table">
                      <thead>
                        <tr>
                          <g:sortableColumn property="username" titleKey="user.username.label" />
                          <g:sortableColumn property="firstname" titleKey="user.firstname.label" />
                        </tr>
                      </thead>
                      <tbody>
                      <g:each in="${role?.users}" status="i" var="user">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                          <td><g:link controller="user" action="show" id="${user?.id}">${user?.username?.encodeAsHTML()}</g:link></td>
                          <td>${user?.firstname?.encodeAsHTML()} ${user?.surname?.encodeAsHTML()}</td>
                        </tr>
                      </g:each>
                      </tbody>
                    </table>
                  </div>
                </td>
              </tr>
              </g:if>
            </tbody>
          </table>
        </fieldset>
      </div>
      <div class="buttons">
        <g:form>
          <input type="hidden" name="id" value="${role?.id}" />
          <span class="button"><g:actionSubmit action="edit" class="edit" value="${message(code:'global.edit')}" action="edit" /></span>
        </g:form>
      </div>
    </div>
  </body>
</html>